<?
require_once("mvc/action/Action.php");
require_once("cms/forum/om/TopicReplyPeer.php");

class EditAction extends Action {

    private $log;

    public function __construct() {
        $this->log =& LoggerManager::getLogger("EditAction");
    }

    public function execute(ActionConfig &$mapping, &$form, Request &$request, Response &$response) {

        if($form->getReply()->getTopicReplyId() > 0) {
            $reply = TopicReplyPeer::retrieveByPk($form->getReply()->getTopicReplyId());
            if(!is_null($reply)) {

                $form->setReply($reply);

            } else {
                $this->log->error("No reply found with id {$form->getReply()->getTopicReplyId()}.");
                $form->getReply()->setTopicReplyId("");
            }

        }

        return $mapping->findForward("success");

    }

}
?>